<?php
namespace Cyfy\Modules\GoogleAnalytics\Forms;

use \Cyfy\Message;
use \Cyfy\Modules\Forms;
use \Cyfy\Modules\GoogleAnalytics\Module;

/**
 * GoogleAnalytics settings
 */
class Settings extends Forms\Form{

	function structure()
	{		
        $this -> permission("GoogleAnalytics", "administration");
		
		$i = new Forms\TextBox("trackingCode", self :: t(40));
		$i -> maxLength = 50;
		$this -> addItem($i);
		
		$b = new Forms\Button(self :: t(50), Forms\Button::OK);
		$this -> addButton($b);
    }
  
	function submit()
	{
		Module :: define("trackingCode", $this -> get("trackingCode"));
        
		\Cyfy\Message :: set(self :: t(60));
        
        if($this -> get("trackingCode") == '')
        {
            \Cyfy\Message :: set(self :: t(70), \Cyfy\Message::WARNING);
        
        }
	}	

}
